package net.starwifi.duobao.rmi;

import net.starwifi.duobao.SettingUtils;
import net.starwifi.duobao.utils.HttpUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2015/12/1.
 */
public class AppRMIUtils {


    public static String rmiApi(String key,String content){
        String rmiUrl=SettingUtils.get("rmiApi");
        String rmiPass=SettingUtils.get("rmiPass");
        Map<String,Object> params=new HashMap<String, Object>();
        params.put("key",key);
        params.put("pass",rmiPass);
        params.put("content",content);
        return HttpUtils.get(rmiUrl,params);
    }


    public static String pageCache(){
        String rmiUrl=SettingUtils.get("rmiApi");
        String rmiPass=SettingUtils.get("rmiPass");
        Map<String,Object> params=new HashMap<String, Object>();
        params.put("key","pageCache");
        params.put("pass",rmiPass);
        return HttpUtils.get(rmiUrl,params);
    }

    public static String memCache(){
        String rmiUrl=SettingUtils.get("rmiApi");
        String rmiPass=SettingUtils.get("rmiPass");
        Map<String,Object> params=new HashMap<String, Object>();
        params.put("key","memCache");
        params.put("pass",rmiPass);
        return HttpUtils.get(rmiUrl,params);
    }



    public static String buildDBIndex(){
        String rmiUrl=SettingUtils.get("rmiApi");
        String rmiPass=SettingUtils.get("rmiPass");
        Map<String,Object> params=new HashMap<String, Object>();
        params.put("key","buildDBTimes");
        params.put("pass",rmiPass);
        return HttpUtils.get(rmiUrl,params);
    }

    public static String buildDBTimesByTimesNo(String timesNo){
        String rmiUrl=SettingUtils.get("rmiApi");
        String rmiPass=SettingUtils.get("rmiPass");
        Map<String,Object> params=new HashMap<String, Object>();
        params.put("key", "buildDBTimes");
        params.put("content", timesNo);
        params.put("pass",rmiPass);
        return HttpUtils.get(rmiUrl,params);
    }

    public static String buildDBProduct(String timesNo){
        String rmiUrl=SettingUtils.get("rmiApi");
        String rmiPass=SettingUtils.get("rmiPass");
        Map<String,Object> params=new HashMap<String, Object>();
        params.put("key", "buildDBProduct");
        params.put("content", timesNo);
        params.put("pass",rmiPass);
        return HttpUtils.get(rmiUrl,params);
    }

    /** use the old rmi api.*/
    public static String buildDBTimes(Long id){
        String rmiUrl=SettingUtils.get("rmiStatic");
        String rmiPass=SettingUtils.get("rmiPass");
        Map<String,Object> params=new HashMap<String, Object>();
        params.put("key", "dbTimes");
        params.put("content", id);
        params.put("pass",rmiPass);
        return HttpUtils.get(rmiUrl,params);
    }



}
